package com.jokelandave.poc.server;

import org.restlet.client.resource.Delete;
import org.restlet.client.resource.Get;
import org.restlet.client.resource.Put;
import org.restlet.resource.ServerResource;

import com.jokelandave.poc.shared.Address;
import com.jokelandave.poc.shared.Contact;
import com.jokelandave.poc.shared.ContactResource;

public class ContactServerResource extends ServerResource implements
		ContactResource {


    private static volatile Contact contact = new Contact("Scott", "Tiger",
            new Address("10 bd Google", null, "20010", "Mountain View", "USA"),
            40);

    @Delete
    public void remove() {
        contact = null;
    }

    @Get("retrieve")
    public Contact retrieve() {
        return contact;
    }

    @Put
    public void store(Contact contact) {
        ContactServerResource.contact = contact;
    }

}
